<?php
	class Database
	{
		private static $instance;
		private static $db;
		
		private function __construct()
		{
			$this->db = new mysqli(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT);
			
			if ($this->db->connect_error) {
        		die('MySQLi Connect Error (' . $this->db->connect_errno . ') ' . $this->db->connect_error);
    		}
		}
		
		static function Instance()
		{
			if (!self::$instance)
	        {
	      		self::$instance = new Database();
	        }
	        
        	return self::$instance->db; 
		}
	}
?>